package com.example.my_forum.controller;


import com.example.my_forum.common.AppResult;
import com.example.my_forum.exception.ApplicationException;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {


    @RequestMapping("/hello")
    @ApiOperation("测试接口1，显示你好")
    public String hello(){
         return "hello";
    }

    @GetMapping("/exception")
    public AppResult testException () throws Exception {
        throw new Exception("这是一个Exception...");
    }


    @GetMapping("/appException")
    public AppResult testApplicationException () {
        throw new ApplicationException("这是一个ApplicationException...");
    }


}
